<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>Document</title>
	<script type="text/javascript" src='jquery-1.7.2.min.js'></script>
	<script type="text/javascript">
		$(function(){
			$('.btn1').click(function(){
				$('input:checkbox').attr('checked','checked');
			})
			$('.btn2').click(function(){
				$('input:checkbox').removeAttr('checked');
			})
			$('.btn3').click(function(){
				var c = $('input:checkbox[checked]');
				$('input:checkbox').attr('checked','checked');
				c.removeAttr('checked');
			})
		})
	</script>
</head>
<body>
	<input type="checkbox" />11 <br />
	<input type="checkbox" />22 <br />
	<input type="checkbox" />33 <br />
	<input type="checkbox" />44 <br />
	<input type="button" value="全选" class="btn1" />
	<input type="button" value="全不选" class="btn2" />
	<input type="button" value="反选" class="btn3" />
</body>
</html>